# templates/schema.py.j2
from datetime import datetime
from fastapi_utils.api_model import APIModel
from pydantic import Field
from typing import Optional
from fastapi import Depends, Query
from src.core.dependencies import QueryParams, Paging
from src.core.query_builder import FilterCriteria, QueryType
from src.schemas.base_schema import MixinSchema
{% if has_email_type %}from pydantic import EmailStr{% endif %}
{% if has_custom_validators %} from pydantic import field_validator{% endif %}

class {{ model_name }}Params(QueryParams):
    def __init__(
        self,
        params: Paging = Depends(Paging),
    ):
        super().__init__(params)

class {{ model_name }}Create(APIModel):
    {% for field in fields if not field.is_key %}
    {{ field.name }}: {% if not field.required %}Optional[{{ field.py_type }}]{% else %}{{ field.py_type }}{% endif %} = Field(
        {% if field.default_value is not none %}{{ field.default_value }}{% else %}...{% endif %},
        description="{{ field.description }}",
    )
    {% endfor %}

class {{ model_name }}Update({{ model_name }}Create):
    id: int = Field(..., title="id")

class {{ model_name }}Out(MixinSchema, {{ model_name }}Create):
    pass